﻿<UserControl x:Class="Tech4WPF.ChartControl.ChartControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             x:Name="chartControl"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid x:Name="grid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock Margin="2" x:Name="tblTitle" Grid.Column="1" Grid.Row="0" 
                RenderTransformOrigin="0.5,0.5" FontSize="14" FontWeight="Bold" 
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextAlignment="Center" 
                Text="{Binding ElementName=chartControl, Path=Title}"/>

        <TextBlock Margin="2" x:Name="tblXLabel" Grid.Column="1" Grid.Row="2" 
               RenderTransformOrigin="0.5,0.5" TextAlignment="Center" 
               Text="{Binding ElementName=chartControl, Path=XLabel}"/>

        <TextBlock Margin="2" Name="tblYLabel" Grid.Column="0" Grid.Row="1" 
                RenderTransformOrigin="0.5,0.5" TextAlignment="Center" 
                Text="{Binding ElementName=chartControl, Path=YLabel}">
                <TextBlock.LayoutTransform>
                    <RotateTransform Angle="-90"/>
                </TextBlock.LayoutTransform>
        </TextBlock>

        <Grid Margin="0" x:Name ="chartGrid" Grid.Column="1" Grid.Row="1"
			   ClipToBounds="True" Background="Transparent" SizeChanged="onChartGridSizeChanged" />

        <Canvas Margin="2" Name="rootCanvas" ClipToBounds="True" Grid.Column="1" Grid.Row="1">
            <Canvas Name="chartCanvas" ClipToBounds="True">
                <Canvas Name="legendCanvas" Background="Transparent" />
            </Canvas>
        </Canvas>
    </Grid>
</UserControl>
